<%@ page import="java.lang.reflect.Array" %>
<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2021/4/20
  Time: 20:23
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户登录</title>
    <link rel="stylesheet" href="/jkd/css/login.css">
    <%
        String userName = "";
        String password = "";
        Cookie[] cookies  =  request.getCookies();
        for (Cookie cookie : cookies) {
            if("userName".equals(cookie.getName())){
                String value = cookie.getValue();
              userName = value;
            }
            if("password".equals(cookie.getName())){
                String value = cookie.getValue();
                password = value;
            }
        }
    %>

    <%
     String exit = request.getParameter("exit");
//     点击退出时清空session的缓存
     if(exit != null){
         session.invalidate();
     }
    %>
</head>
<body>
<div>

    <div class="center">
        <div class="header">
            <h3>用户登录 </h3>
        </div>
        <div class="con">
        <div class="login">
            <form action="/jkd/service/login" method="post">
                <h1 style="text-align: center;color: #d9534f">学生宿舍服务服务平台</h1>
                用户名:<input name="stuNum" type="text" value = "<%=userName%>"> <br/>
                <c:if test="${error == 0}">
                <p style="margin: 0;padding: 0;color: red;font-size: 12px" id="user">用户名错误！</p>
                </c:if>
            &nbsp;&nbsp;&nbsp;&nbsp;密码:<input name="password" type="text" value="<%=password%>"><br/>

                <c:if test="${error == 1}">
                <p style="margin: 0;padding: 0;color: red;font-size: 12px" id="word">密码错误！</p>
                </c:if>
                &nbsp;&nbsp;&nbsp;<button type="submit" id="btn" >登录</button>
                <div class="remember"> <input type="checkbox" value="on" name="isRemember" style="width: 20px;height: 20px;display: inline-block"
                <c:if test="${checked == 'on'}">checked</c:if>
                ><span>记住密码</span></div>
                <div class="forget" name="isForget"><a href="/jkd/service/login?forget=1">忘记密码</a></div>
            </form>
        </div>
        </div>
    </div>
    <script>

    </script>
</div>
<script type="text/javascript" src="/jkd/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/jkd/plugins/bootstrap/js/bootstrap.js"></script>
</body>
</html>
